import {
  adminRoutes
} from "../router/index";


const menuList = (menuList = [], action) => {
  switch (action.type) {
    case "setMenuList": {
      let roleType = localStorage.getItem("roletype")
      let menuarr = [...adminRoutes];
      menuarr.forEach(item => {
        if (item.isshow.indexOf(roleType) !== -1) {
          item.show = true;
        } else {
          item.show = false;
        }
      })
      console.log(adminRoutes)
      menuList = menuarr;
      localStorage.setItem("menuList", JSON.stringify(menuList))
      return menuList;
    }
    default:
      return menuList;
  }
}

export default menuList